using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Resources;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using KPIS.GERP.Models.Class;

namespace KPIS.GERP.Models.ICM
{
    [DataContract, Table("IcmRequestParcel")]
    public class RequestParcel
    {
        public RequestParcel()
        {
            //RequestDtls = new HashSet<RequestParcelDtl>();
        }

		[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DataMember, Display(Name = "ReqParcelId", ResourceType = typeof(Resources.RequestParcelResource))]
        public int ReqParcelId { get; set; }

        [CustomRequired]
		[DataMember, Display(Name = "IcmReqCode", ResourceType = typeof(Resources.RequestParcelResource))]
        public string IcmReqCode { get; set; }

		[DataMember, Display(Name = "IcmResItemCode", ResourceType = typeof(Resources.RequestParcelResource))]
        public string IcmResItemCode { get; set; }

		[ForeignKey("JobSite")]
		[DataMember, Display(Name = "JobSiteId", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<int> JobSiteId { get; set; }

        [CustomRequired]
		[DataMember, Display(Name = "RequestName", ResourceType = typeof(Resources.RequestParcelResource))]
        public string RequestName { get; set; }

        [ForeignKey("WarehousePermit")]
        [CustomRequired]
        [DataMember, Display(Name = "WarehousePermitId", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<int> WarehousePermitId { get; set; }

		[DataMember, Display(Name = "Remarks", ResourceType = typeof(Resources.RequestParcelResource))]
        public string Remarks { get; set; }

        [ForeignKey("Employee")]
		[DataMember, Display(Name = "RequestBy", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<int> RequestBy { get; set; }

		[DataMember, Display(Name = "CreatedBy", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<int> CreatedBy { get; set; }

        [CustomRequired]
        [DataMember, Display(Name = "CreatedWhen", ResourceType = typeof(Resources.RequestParcelResource))]
        public DateTime? CreatedWhen { get; set; }

		[DataMember, Display(Name = "UpdatedBy", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<int> UpdatedBy { get; set; }

		[DataMember, Display(Name = "UpdatedWhen", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<System.DateTime> UpdatedWhen { get; set; }

       // [CustomRequired]
	  //[DataMember, Display(Name = "RequestDate", ResourceType = typeof(Resources.RequestParcelResource))]
      // public Nullable<System.DateTime> RequestDate { get; set; }

        [ForeignKey("MasResourceType")]
		[DataMember, Display(Name = "IcmResTypeId", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<int> IcmResTypeId { get; set; }

        [CustomRequired]
		[DataMember, Display(Name = "WantedDate", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<System.DateTime> WantedDate { get; set; }

        //[DataMember, Display(Name = "Status", ResourceType = typeof(Resources.RequestParcelResource))]
        //public string Status { get; set; }

		[DataMember, Display(Name = "ApprovedBy", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<int> ApprovedBy { get; set; }

		[DataMember, Display(Name = "ApprovedDate", ResourceType = typeof(Resources.RequestParcelResource))]
        public Nullable<System.DateTime> ApprovedDate { get; set; }

		[DataMember, Display(Name = "Reason", ResourceType = typeof(Resources.RequestParcelResource))]
        public string Reason { get; set; }

        [StringLength(2)]
		[DataMember, Display(Name = "RecordStatus", ResourceType = typeof(Resources.RequestParcelResource))]
        public string RecordStatus { get; set; }

        [ForeignKey("Project")]
        [DataMember, Display(Name = "ProjectId", ResourceType = typeof(Resources.RequestParcelResource))]
        public int? ProjectId { get; set; }


        [DataMember]
		public virtual HRM.JobSite JobSite { get; set; }

        [DataMember]
        public virtual HRM.Employee Employee { get; set; }

        [DataMember]
        public virtual WarehousePermit WarehousePermit { get; set; }

        [DataMember]
        public virtual MasResourceType MasResourceType { get; set; }

        

        [DataMember]
        public virtual BGM.Project Project { get; set; }

        //[DataMember]
        //public virtual ICollection<RequestParcelDtl> RequestDtls { get; set; }

    }
}